package sample.negative.bean;

/**
 * 正方形
 */
public class Square extends Rectangle{

    public Square(double size){
        super(size, size);
    }

    @Override
    public void setWidth(double width) {
        this.width = width;
        this.height = width; // 强制保持正方形
    }

    @Override
    public void setHeight(double height) {
        this.height = height;
        this.width = height; // 强制保持正方形
    }
}
